﻿@{
    Layout = "~/Views/Shared/_FormWhite.cshtml";
}

<div class="wrapper animated fadeInRight">
    <form id="form" class="form-horizontal m">
        <input type="hidden" id="productId" col="productId">
        <input type="hidden" id="goodsId" col="goodsId">
        <div class="form-group">
            <label class="col-sm-3 control-label ">入库数</label>
            <div class="col-sm-8">
                <input id="storageCount" col="storageCount" type="text" class="form-control" />
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
    var id = ys.request("id");//弃用
    var pid = ys.request("pid");
    var goodsid = ys.request("goodsid");
    $(function () {
        //getForm();
        $("#productId").val(pid);
        $("#goodsId").val(goodsid);

        $('#form').validate({
            rules: {
                storageCount: { required: true,isInteger:true}
            }
        });
    });

    //function getForm() {
    //    if (id > 0) {
    //        ys.ajax({
    //            url: '@Url.Content("~/QixingManage/GoodsStorageRecord/GetFormJson")' + '?id=' + id,
    //            type: 'get',
    //            success: function (obj) {
    //                if (obj.Tag == 1) {
    //                    $('#form').setWebControls(obj.Data);
    //                }
    //            }
    //        });
    //    }
    //    else {
    //        var defaultData = {};
    //        $('#form').setWebControls(defaultData);
    //    }
    //}

    function saveForm(index) {
        if ($('#form').validate().form()) {
            var postData = $('#form').getWebControls({ Id: id });
            ys.ajax({
                url: '@Url.Content("~/QixingManage/GoodsStorageRecord/SaveFormJson")',
                type: 'post',
                data: postData,
                success: function (obj) {
                    if (obj.Tag == 1) {
                        ys.msgSuccess(obj.Message);
                        parent.searchGrid();
                        parent.layer.close(index);
                    }
                    else {
                        ys.msgError(obj.Message);
                    }
                }
            });
        }
    }
</script>

